<?php /* Smarty version Smarty-3.1.18, created on 2017-07-22 21:15:53
         compiled from "/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/member.edit.html" */ ?>
<?php /*%%SmartyHeaderCode:42169383459734ffad088c8-64082895%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '412d5bd784ca5caab04f8e82fe9175a6f3c29e3d' => 
    array (
      0 => '/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/member.edit.html',
      1 => 1500729350,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '42169383459734ffad088c8-64082895',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_59734ffae05609_44914033',
  'variables' => 
  array (
    'member' => 0,
    'weixin_sign_package' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_59734ffae05609_44914033')) {function content_59734ffae05609_44914033($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView">个人资料</div>
</div>

<div class="member-edit main-top">
	<ul class="tableView tableView-noMargin tableView-light">
		<li>
			<a class="avatar" href="javascript:void(0)">
				<h1><big><div <?php if ($_smarty_tpl->tpl_vars['member']->value->id>0&&$_smarty_tpl->tpl_vars['member']->value->avatar!='') {?>style="background-image:url(<?php echo $_smarty_tpl->tpl_vars['member']->value->avatar;?>
);"<?php }?>></div></big>头像</h1>
			</a>
		</li>
		<li>
			<a id="name" href="javascript:void(0)">
				<h1><big><?php if ($_smarty_tpl->tpl_vars['member']->value->id>0) {?><?php echo $_smarty_tpl->tpl_vars['member']->value->nick_name;?>
<?php }?></big>昵称</h1>
			</a>
		</li>
		<li>
			<h1><big><?php if ($_smarty_tpl->tpl_vars['member']->value->id>0) {?><?php echo $_smarty_tpl->tpl_vars['member']->value->sex;?>
<?php }?></big>性别
			<select id="sex">
			<option value="男" <?php if ($_smarty_tpl->tpl_vars['member']->value->id>0&&$_smarty_tpl->tpl_vars['member']->value->sex=='男') {?>selected<?php }?>>男</option>
			<option value="女" <?php if ($_smarty_tpl->tpl_vars['member']->value->id>0&&$_smarty_tpl->tpl_vars['member']->value->sex=='女') {?>selected<?php }?>>女</option>
			</select></h1>
		</li>
		<li>
			<h1><big><?php if ($_smarty_tpl->tpl_vars['member']->value->id>0&&$_smarty_tpl->tpl_vars['member']->value->birth_year>0) {?><?php echo $_smarty_tpl->tpl_vars['member']->value->birth_year;?>
-<?php echo $_smarty_tpl->tpl_vars['member']->value->birth_month;?>
-<?php echo $_smarty_tpl->tpl_vars['member']->value->birth_day;?>
<?php }?></big>生日
			<input type="date" id="date" value="<?php if ($_smarty_tpl->tpl_vars['member']->value->id>0&&$_smarty_tpl->tpl_vars['member']->value->birth_year>0) {?><?php echo $_smarty_tpl->tpl_vars['member']->value->birth_year;?>
-<?php echo $_smarty_tpl->tpl_vars['member']->value->birth_month;?>
-<?php echo $_smarty_tpl->tpl_vars['member']->value->birth_day;?>
<?php }?>" /></h1>
		</li>
	</ul>
</div>

<?php echo $_smarty_tpl->getSubTemplate ("footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<?php if (isset($_smarty_tpl->tpl_vars['weixin_sign_package']->value)) {?>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<?php }?>
<script>
function selectImage(){
	$('.avatar').ajaxupload({
		url : 'api.php?app=member&act=avatar',
		postName : 'avatar',
		callback : {
			success : function(json, status){
				if(json.error!=0){ $.overloadError(json.msg);return }
				$('.avatar big div').css('background-image', 'url('+json.data+')');
			},
			error : function(xml, status, e){
				alert('Upload error\n'+e);
			}
		}
	});
}
$(function(){
	if(!$.browser.wx)selectImage();
	$('#name').click(function(){
		var _this = $(this),
		html = '<div class="member-name" cls="overlay-big" delay-cls="overlay-normal" close-cls="overlay-small">\
			<div class="tip"><span>昵称</span></div>\
			<input type="text" placeholder="请输入昵称" value="<?php if ($_smarty_tpl->tpl_vars['member']->value->id>0) {?><?php echo $_smarty_tpl->tpl_vars['member']->value->nick_name;?>
<?php }?>" />\
			<a class="ge-top ge-light" href="javascript:void(0)">确定</a>\
		</div>';
		$.overlay(html, 3, function(){
			$('.member-name a').click(function(){
				var val = $(this).prev().val();
				$.postJSON('api.php?app=member&act=edit_info', { nick_name:val }, function(json){
					if(json.error!=0){ $.overloadError(json.msg);return }
					_this.parent().find('big').html(val);
					$.overlay(false);
				});
			});
		});
	});
	$('#sex').change(function(){
		var _this = $(this), val = _this.val();
		$.postJSON('api.php?app=member&act=edit_info', { sex:val }, function(json){
			if(json.error!=0){ $.overloadError(json.msg);return }
			_this.parent().find('big').html(val);
		});
	});
	$('#date').change(function(){
		var _this = $(this), val = _this.val(), arr = val.split('-');
		$.postJSON('api.php?app=member&act=edit_info', { birth_year:arr[0], birth_month:arr[1], birth_day:arr[2] }, function(json){
			if(json.error!=0){ $.overloadError(json.msg);return }
			_this.parent().find('big').html(val);
		});
	});
});
<?php if (isset($_smarty_tpl->tpl_vars['weixin_sign_package']->value)) {?>
wx.config({
	debug: false,
	appId: "<?php echo $_smarty_tpl->tpl_vars['weixin_sign_package']->value['appId'];?>
",
	timestamp: "<?php echo $_smarty_tpl->tpl_vars['weixin_sign_package']->value['timestamp'];?>
",
	nonceStr: "<?php echo $_smarty_tpl->tpl_vars['weixin_sign_package']->value['nonceStr'];?>
",
	signature: "<?php echo $_smarty_tpl->tpl_vars['weixin_sign_package']->value['signature'];?>
",
	jsApiList: [
		//所有要调用的 API 都要加到这个列表中
		'chooseImage',
		'uploadImage'
	]
});
wx.ready(function(){
	/*//
	wx.checkJsApi({
		jsApiList: [ //需要检测的JS接口列表
			'chooseImage',
			'uploadImage'
		],
		success: function(res){
			alert($.debug(res));
		}
    });
	//*/
	$('.avatar').click(function(){
		var _this = $(this);
		wx.chooseImage({
			success : function(res){
				var localId = res.localIds; //返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
				$.overload('正在上传...');
				setTimeout(function(){
					wx.uploadImage({
						localId: localId.toString(), //需要上传的图片的本地ID，由chooseImage接口获得
						isShowProgressTips: 0, //默认为1，显示进度提示
						success: function(res){
							var serverId = res.serverId; //返回图片的服务器端ID
							$.postJSON('api.php?app=member&act=wx_avatar', { avatar:serverId }, function(json){
								if(json.error!=0){ $.overloadError(json.msg);return }
								_this.find('big div').css('background-image', 'url('+json.data+')');
							});
						},
						fail: function(res){
							$.overload(false);
							alert($.debug(res));
						}
					});
				}, 100);
			}
		});
	});
});
<?php }?>
</script><?php }} ?>
